using System;

namespace FluffyUnderware.Curvy.Controllers
{
	public static class MovementDirectionMethods
	{
		public static MovementDirection FromInt(int value)
		{
			return (value < 0) ? MovementDirection.Backward : MovementDirection.Forward;
		}

		public static MovementDirection GetOpposite(this MovementDirection value)
		{
			switch (value)
			{
			case MovementDirection.Forward:
				return MovementDirection.Backward;
			case MovementDirection.Backward:
				return MovementDirection.Forward;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		public static int ToInt(this MovementDirection direction)
		{
			switch (direction)
			{
			case MovementDirection.Forward:
				return 1;
			case MovementDirection.Backward:
				return -1;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}
	}
}
